package cn.wolfcode.crm.shiro;

import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ModelAttribute;

//@ControllerAdvice
public class ControllerExceptionAdvice {

    @ExceptionHandler(Exception.class)
    public String handerException(@ModelAttribute("ex") Exception e){
        return "common/error";
    }

    @ExceptionHandler(UnauthorizedException.class)
    public String handerUnauthorizedException(){
        return "common/nopermission";
    }
}
